<script lang="ts">
  export default {
    name: '代码生成列表',
  }
</script>

<script lang="ts" setup>
  import { CommonList } from '@longnows/ui'
  import { useTables, useActionFun, useForms, useListOperation } from './hooks'

  import { onMounted, ref, toRefs } from 'vue'

  const pageCode = "<%= pageCode %>"
  const commonListRef = ref<InstanceType<typeof CommonList> | null>(null)
  //查询
  const getList = (searchReq: Recordable, pageReq: Recordable) => {
    return Promise.resolve({
      code:0,
      data: [{}],
      total: 0
    })
  }

  const { afterGetColumns } =  toRefs(useTables()) 
  const { actionFun,afterGetActions } = toRefs(useActionFun(commonListRef))
  const { getOptions,afterGetSchemas,fieldMapToTime } = toRefs(useForms())
  const { addOperationColumn } = toRefs(useListOperation(commonListRef))

  onMounted(() => {
    commonListRef.value?.refresh()
  })

</script>

<template>
  <CommonList
    ref="commonListRef"
    :pageCode="pageCode"
    :actionFun="actionFun"
    :getOptions="getOptions"
    :getList="getList"
    :tableProps="{ rowSelection: false }"
    :afterGetColumns="afterGetColumns"
    :afterGetSchemas="afterGetSchemas"
    :afterGetActions='afterGetActions'
    :fieldMapToTime="fieldMapToTime"
    :addOperationColumn="addOperationColumn"
  ></CommonList>

 
</template>